package com.crm.controller;

import com.crm.common.oss.AliyunOSSOperator;
import com.crm.common.result.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RestController
@RequestMapping("/profile")
public class GetUploadController {

    @Autowired
    private AliyunOSSOperator aliyunOSSOperator;

    //查询上传文件
    @GetMapping("/upload")
    public AjaxResult GetUpload(@PathVariable String url) throws Exception {
        log.info("文件地址{}",url);
        if (url != null){
            Object object = aliyunOSSOperator.getObject(url);
            return AjaxResult.success(object);
        }
        return AjaxResult.error("查询失败");

    }


}
